#include <iostream>
using namespace std;
int n;
int gcd(int x, int y)
{
    int r;
    while (y > 0)
    {
        r = x % y;
        x = y;
        y = r;
    }
    return x;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a = 0;
    cin >> n;
    if (n % 2)
    {
        int b = 1;
        while (1)
        {
            if (n == 2 * b - 1)
                break;
            b++;
        }
        int a = 0, c = 1;
        while (1)
        {
            a += (c * 2 - 1);
            if (b <= a)
                break;
            c++;
        }
        int e = c * 2 - 1;
        int d = e - (a - b);
        cout << e * d / gcd(e, d);
    }
    else
    {
        int b = 1;
        while (1)
        {
            if (n == 2 * b)
                break;
            b++;
        }
        int a = 0, c = 1;
        while (1)
        {
            a += c * 2;
            if (b <= a)
                break;
            c++;
        }
        int e = 2 * c;
        int d = e - (a - b);
        cout << e * d / gcd(e, d);
    }
    return 0;
}